home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / mpfeel.lha / MPFeel / Plurals / mp_mem_mgmt.h < prev    next >
C/C++ Source or Header  |  1992-05-29  |  2KB  |  78 lines

  1. /*
  2.  *    Plurals
  3.  *
  4.  *    Author:    S.C.Merrall
  5.  *
  6.  *    File:    mp_mem_mgmt.h
  7.  *
  8.  *    Contents:    
  9.  *
  10.  *    Description:    
  11.  *
  12.  *    Change History:
  13.  *
  14.  *    Date   Name Comment
  15.  *    -------- ---- -------
  16.  *    21:02:91 SCM  Created
  17.  *    15:04:91 SCM  Allocate data in 32 bit blocks
  18.  *    16:05:91 SCM  alloc_lispobject moved to mp_alloc.h
  19.  *    16:05:91 SCM  heap_memory moved to mp_gc.h
  20.  *    21:05:91 SCM  alloc_plural added (no longer visible)
  21.  *    25:06:91 SCM  Removed memory size definition - compile-time determined
  22.  *    04:06:91 SCM  Heap Header now 16-bits
  23.  *
  24.  */
  25.  
  26. #define MEMORY_SIZE (MEMORY_SIZE_IN_BYTES/sizeof(heap_header))
  27.  
  28.                                           /*  8K in 32 bit words            */
  29.  
  30. #define TOP ((MEMORY_SIZE_IN_BYTES/sizeof(natural))-1)
  31.  
  32.                                           /*  Highest index in 16 bit words */
  33.  
  34. /*  #define heap2plural(x) (2*(x))     Convert heap offsets to plural offsets
  35.  *  #define plural2heap(x) ((x)/2)
  36.  */
  37.  
  38. #define heap2plural(x) (x)
  39. #define plural2heap(x) (x)
  40.  
  41. #define byte2heap(x) ((x)/sizeof(heap_header))
  42. #define heap2byte(x) (sizeof(heap_header)*(x))
  43.  
  44. #define byte2plural(x) ((x)/sizeof(natural))
  45. #define plural2byte(x) (sizeof(natural)*(x))
  46.  
  47. #define space_to_grow(for_n_bytes) globalor((plural_space - heap2plural(heap_space)) > (1 + byte2plural(for_n_bytes)))
  48.  
  49. #define FREE_FLAG (natural)0x8000
  50.  
  51. #define Free_P(x) (x==FREE_FLAG)
  52. #define Null_P(x) (x==NIL)
  53.  
  54. /* #define HEAP_BLOCK_SIZE 4        size of heap allocation blocks in bytes */
  55.  
  56. /* typedef unsigned char byte; */
  57.  
  58. /* extern plural natural plural_memory[]; */
  59.  
  60. extern plural natural *plural plural_memory;
  61.  
  62. extern plural heap_header heap_memory[];
  63. extern natural plural_space;
  64. extern plural natural  heap_space;
  65.  
  66. /* extern plural char scratch[]; */
  67.  
  68.  
  69. #ifdef __STDC__
  70.  
  71. extern natural alloc_plural( object, int )
  72.  
  73. #else
  74.  
  75. extern natural alloc_plural();
  76.  
  77. #endif
  78.